﻿/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is tyzoh.jp code.
 *
 * The Initial Developer of the Original Code is Kazutaka Kurihara.
 * Portions created by the Initial Developer are Copyright (C) 2007
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace Qurihara.Anm
{
    /// <summary>
    /// FPSManager
    /// </summary>
    public class FPSManager
    {
        public FPSManager(int intvl)
        {
            interval = intvl;
            timer = new Timer();
            //			timer.Tick += new EventHandler(TickEventHandler);
            timer.Interval = intvl;
            timer.Enabled = true;
            timer.Start();
        }
        public int Interval
        {
            get { return interval; }
            set { interval = value; }
        }
        //		public void Enqueue(IAnmElement ae)
        //		{
        //			//anmElementList.Add(ae);
        //			anmElementList.Add(ae.BoundingBox);
        //			anmElement = ae;
        //		}
        //		public void Add(IAnm anm)
        //		{
        //			anmList.Add(anm);
        //		}
        //		public void Remove(IAnm anm)
        //		{
        //			anmList.Remove(anm);
        //		}
        public Timer Timer
        {
            get { return timer; }
        }
        //protected IAnmElement anmElement = null;
        //protected ArrayList anmElementList = new ArrayList();
        protected ArrayList anmList = new ArrayList();
        protected int interval;
        protected Timer timer;
        //protected IEnumerator enume;
        //		protected void TickEventHandler(object o,EventArgs e)
        //		{
        //			enume = anmElementList.GetEnumerator();
        //			while(enume.MoveNext())
        //			{
        //				anmElement.Invalidate((Rectangle)enume.Current);
        //				//((IAnmElement)enume.Current).Invalidate();
        //			}
        //			anmElementList.Clear();
        //		}
        //		protected void TickEventHandler(object o, EventArgs e)
        //		{
        //			foreach(IAnm anm in anmList)
        //			{
        //				anm.Step();
        //			}
        //		}
    }
}
